<?php 
include('../Connections/KRAPPERCON.php');

$sql= "select * from tt_clase_gasto;";
$gv = '';
$ga = '';
$res = $mysqli->query($sql);
if($res){
	while($row=$res->fetch_assoc()){
		if (substr($row['claseID'],0,1)=='A'){
		 $ga=$ga."<option value='".$row['claseID']."'>".$row['txtClase']."</option>";
		}
		elseif (substr($row['claseID'],0,1)=='V'){
		 $gv=$gv."<option value='".$row['claseID']."'>".$row['txtClase']."</option>";
		}
	}
	$res->close();
	$mysqli->check_result();	
	echo "<optgroup label='Gastos Administrativos'>".$ga."</optgroup>".
		"<optgroup label='Gastos de Venta'>".$gv."</optgroup>".
		"<optgroup label='Compras de Mercaderia'><option value='CST'>Compras de Stock</option></optgroup>";
}
?>